<h2><?=tr('Proxys administration')?></h2>
<p class="backpage">&raquo; <?=fgsBase::linkPage(tr('Add a proxy'), 'admin_proxys', array('add'))?></p>
<?php

	if (!is_null($form)) {

		echo $form->output();
		
	} else {

		$proxys = fgsProxys::getAll();

		if (!$proxys)
			echo tr('No proxys yet');
		else {
			$tbl = new htmlTable();

			$tbl->setHeader('action', array(
				'width' => '50px',
			));
			$tbl->setHeader('id', array(
				'title' => tr('Id'),
				'width' => '5ex',
			));
			$tbl->setHeader('name', array(
				'title' => tr('Name'),
			));
			$tbl->setHeader('key', array(
				'title' => tr('Key'),
				'width' => '40ex',
			));
			$tbl->setHeader('ip', array(
				'title' => tr('Ip'),
				'width' => '20ex',
			));
			$tbl->setHeader('status', array(
				'title' => tr('Status'),
				'width' => '13ex',
			));

			foreach ($proxys as $n) {
				$tbl->set('id', $n['id']);
				$tbl->set('name', $n['fgsd_name']);
				$tbl->set('key', $n['fgsd_key']);
				$tbl->set('ip', $n['fgsd_ip']);
				$tbl->set('status', $n['fgsd_status'] ? tr('Online') : tr('Offline'));

				$actions = array();
				if (!$n['fgsd_isblacklisted']) {
					$actions[] = fgsBase::linkPage(fgsBase::image('del'), 'admin_proxys', array('hide', $n['id']));
				} else {
					$tbl->setLineParam('class', 'disabled');
					$actions[] = fgsBase::linkPage(fgsBase::image('ok'), 'admin_proxys', array('show', $n['id']));
				}
				$actions[] = fgsBase::linkPage(fgsBase::image('edit'), 'admin_proxys', array('edit', $n['id']));

				$tbl->set('action', implode(' ', $actions));
					
				$tbl->push();
			}

			echo $tbl->render();
		}	

	}
	
?>
